﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Properties;
using System.Data;
using System.Data.SqlClient;

namespace IngressApp.DAC
{
    public class DACInsert
    {
        DBInfo Info = new DBInfo();
        public bool insertRecord(Empleado obj)
        {
            

            SqlConnection con = new SqlConnection(Info.sqlSet());
            SqlCommand cmd = new SqlCommand("SP_Empleado_Insert", con);
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@Nombre", SqlDbType.VarChar).Value = obj.Nombres;
            cmd.Parameters.Add("@ApellidoPaterno", SqlDbType.VarChar).Value = obj.ApellidoPaterno;
            cmd.Parameters.Add("@ApellidoMaterno", SqlDbType.VarChar).Value = obj.ApellidoMaterno;
            cmd.Parameters.Add("@Foto", SqlDbType.VarChar).Value = obj.Estado;

            con.Open();

            if (cmd.ExecuteNonQuery() > 0)
                return true;
            else
                return false;



        }
        public bool insertRecord(EmpleadoHuella obj)
        {
            SqlConnection con = new SqlConnection(Info.sqlSet());
            SqlCommand cmd = new SqlCommand("SP_EmpleadoHuella_Insert",con);
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@IdEmpleado", SqlDbType.Int).Value = obj.IdEmpleado;
            cmd.Parameters.Add("@IdTipoHuella", SqlDbType.Int).Value = obj.TipoHuella;
            cmd.Parameters.Add("@Huella", SqlDbType.VarChar).Value = obj.Huella;

            con.Open();

            if (cmd.ExecuteNonQuery() > 0)
                return true;
            else
                return false;

        }
        public bool insertRecord(Registro obj)
        {
            SqlConnection con = new SqlConnection(Info.sqlSet());
            SqlCommand cmd = new SqlCommand("SP_Registro_Insert", con);
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@Estado", SqlDbType.Bit).Value = obj.Estado;
            cmd.Parameters.Add("@Fecha", SqlDbType.DateTime).Value = obj.Fecha;
            cmd.Parameters.Add("@IdEmpleado", SqlDbType.Int).Value = obj.IdEmpleado;

            con.Open();

            if (cmd.ExecuteNonQuery() > 0)
                return true;
            else
                return false;

        }

        public bool insertRecord(TipoHuella obj)
        {
            SqlConnection con = new SqlConnection(Info.sqlSet());
            SqlCommand cmd = new SqlCommand("SP_TipoHuella_Insert", con);
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@Clave", SqlDbType.VarChar).Value = obj.Clave;
            cmd.Parameters.Add("@Descripcion", SqlDbType.VarChar).Value = obj.Descripcion;

            con.Open();

            if (cmd.ExecuteNonQuery() > 0)
                return true;
            else
                return false;
        }


    }
}
